##calculate the Cohen's D for the mini-meta
sink("Table1.log")


##t-tests
library(lsr)
library(tidyverse)
##study 1

limited_1<-subset(study1, treatment>2)


cohen_respect1<-cohensD(Independence ~ treatment,
                        data = limited_1)

cohen_respect1

cohen_obed1<-cohensD(Obedience ~ treatment,
                     data = limited_1)

cohen_obed1


cohen_gm1<-cohensD(Curiosity ~ treatment,
                   data = limited_1)

cohen_gm1

cohen_wb1<-cohensD(Considerate ~ treatment,
                   data = limited_1)

cohen_wb1

cohen_auth1<-cohensD( auth~ treatment,
                   data = limited_1)

cohen_auth1

##study 2
limited_2<-study2%>%
  mutate(treatment3 =as.numeric(treatment2))%>%
  filter(treatment3!=2)


cohen_respect2<-cohensD(Independence ~ treatment,
                        data = limited_2)

cohen_respect2

cohen_obed2<-cohensD(Obedience ~ treatment,
                     data = limited_2)

cohen_obed2


cohen_gm2<-cohensD(Curiosity ~ treatment,
                   data = limited_2)

cohen_gm2

cohen_wb2<-cohensD(Considerate ~ treatment,
                   data = limited_2)

cohen_wb2

cohen_auth2<-cohensD( auth~ treatment,
                      data = limited_2)

cohen_auth2


        ##study 3
##create dataset that drops after and before treatments
limitedT<-subset(study3, treatment>1)


cohen_respect3<-cohensD(Respect ~ treatment,
        data = limitedT)

cohen_respect3

cohen_obed3<-cohensD(Obedient ~ treatment,
                       data = limitedT)

cohen_obed3


cohen_gm3<-cohensD(GoodMannered ~ treatment,
                       data = limitedT)

cohen_gm3

cohen_wb3<-cohensD(WellBehaved ~ treatment,
                  data = limitedT)

cohen_wb3


cohen_auth3<-cohensD(auth ~ treatment,
                   data = limitedT)

cohen_auth3

sink()
